package edu.ccut.saturn.workflow.parse;

import java.util.ArrayList;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.workflow.model.ActivityInfo;
import edu.ccut.saturn.workflow.model.WorkFlowInfo;

public class GetActivityIdsInFlow extends DefaultComponent{
	public void execute(IParameterContext parameterContext) throws Exception {
		WorkFlowInfo workflowInfo = (WorkFlowInfo)parameterContext.getParameterValue(0);
		ArrayList<ActivityInfo> activityList = (ArrayList<ActivityInfo>) workflowInfo.getActivities();
		ArrayList<String> activityIdList = null;
		if(activityList!=null){
			activityIdList = new ArrayList<String>();
			for(ActivityInfo info:activityList){
				activityIdList.add(info.getId());
			}
		}
		
		parameterContext.setParameter(1, activityIdList);
	}
}
